#include "resourcemanager.h"

static ResourceManager* instance = NULL;
ResourceManager& ResourceManager::GetInstance()
{
	if (instance==NULL)
	{
		instance = new ResourceManager();
	}
	return *instance;
}

ResourceManager::ResourceManager()
{
	// Graphics
	imgShip.LoadFromFile("media/ship_h1.png");
	imgPlanet.LoadFromFile("media/planet.png");
	imgBullet.LoadFromFile("media/bullet.png");
	imgWeapon.LoadFromFile("media/weapon.png");

	sprShip.SetImage(imgShip);
	sprPlanet.SetImage(imgPlanet);
	sprBullet.SetImage(imgBullet);
	sprBullet.SetScale(0.5f, 0.5f);
	sprWeapon.SetImage(imgWeapon);


	sprShip.SetCenter(imgShip.GetWidth() / 2.f, imgShip.GetHeight() / 2.f);
	sprPlanet.SetCenter(imgPlanet.GetWidth() / 2.f, imgPlanet.GetHeight() / 2.f);
	sprBullet.SetCenter(imgBullet.GetWidth() / 2.f, imgBullet.GetHeight() / 2.f);
	sprWeapon.SetCenter(imgWeapon.GetWidth() / 2.f, imgWeapon.GetHeight() / 2.f);

	// Text
	fontSmall.LoadFromFile("media/airmole.ttf", 30);
	fontMedium.LoadFromFile("media/airmole.ttf", 12);
}

ResourceManager::~ResourceManager()
{
	//dtor
}

void ResourceManager::DrawText(sf::RenderWindow& app, float x, float y, const std::string& text)
{
	app.SetView(app.GetDefaultView());
	// Sender sigtrap? fejl
	//sf::Unicode::Text::Text uct("TEST");
	//sf::String label(uct, fontMedium, FONT_MEDIUM_SIZE);
	//label.SetPosition(x, y);
	//app.Draw(label);
}

